package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.QuestionComment;
import cn.wolfcode.trip.base.mapper.QuestionCommentMapper;
import cn.wolfcode.trip.base.service.IQuestionCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionCommentServiceImpl implements IQuestionCommentService {

    @Autowired
    private QuestionCommentMapper questionCommentMapper;

    // 保存问题评论
    @Override
    public void save(QuestionComment questionComment) {
        questionCommentMapper.insert(questionComment);
    }

    // 获取所有问题评论
    @Override
    public List<QuestionComment> listAll() {
        return questionCommentMapper.selectAll();
    }

    // 获取问题评论数
    @Override
    public int getCommentCountByQuestionId(Long id) {
        return questionCommentMapper.queryForCountById(id);
    }
}
